<template>
    <div v-if="loading">Loading....</div>
    <div v-else-if="data">{{data}}</div>
    <div v-else-if="error">{{error}}</div>
</template>
<script setup>
import {toRefs} from 'vue';
import useFetch from './hooks/useFetch';
const state =useFetch('https://jsonplaceholder.typicode.com/todos/1');
const {loading,data,error} = toRefs(state);
console.log(loading,data,error)
</script>